<template>
	<view class="content" style="overflow: hidden;">
		<uni-grid :show-border="false" :options="menu" @click="onClick"></uni-grid>

	</view>
</template>

<script>
	import uniGrid from "@/static/uni-grid/uni-grid.vue"
	export default {
		data() {
			return {
				means: [{
						text: '扫描入库',
						image: 'icon-rukuguanli'
					},
					{
						text: '库存盘点',
						image: 'icon-pandianguanli_1'
					},
					{
						text: '扫描出库',
						image: 'icon-chukuguanli'
					},
					{
						text: '并箱',
						image: 'icon-chukuguanli'
					},
					{
						text: '退货入库',
						image: 'icon-chukuguanli'
					},
					{
						text: '半成品入库',
						image: 'icon-chukuguanli'
					},
					{
						text: '半成品出库',
						image: 'icon-pandianguanli_1'
					},
					{
						text: '聚水潭调拨',
						image: 'icon-pandianguanli_1'
					}
				],
				menu: [

				],
				uid: '',
				url: ''
			}
		},
		components: {
			uniGrid
		},
		onLoad() {
			this.uid = uni.getStorageSync('id')
			this.url = uni.getStorageSync('url') == '' ? this.websiteUrl : uni.getStorageSync('url')
			this.getMenu()
		},
		methods: {
			getMenu() {
				console.log(this.url);
				uni.request({
					url: `http://${this.url}/bService.asmx/getbas_user_ydqx`,
					method: 'GET',
					data: {
						ls_id: this.uid,
					},
					success: (r) => {
						console.log(r, '2222222');
						if (r.data.length > 0) {

							r.data.forEach(val => {
								let obj = {}
								if (val.menu == '扫描入库') {
									obj.image = 'icon-rukuguanli'
									obj.text = val.menu
								} else if (val.menu == '扫描出库') {
									obj.image = 'icon-chukuguanli'
									obj.text = val.menu
								} else if (val.menu == '库存盘点') {
									obj.image = 'icon-xinchuku'
									obj.text = val.menu
								} else if (val.menu == '并箱') {
									obj.image = 'icon-xinchuku'
									obj.text = val.menu
								} else if (val.menu == '退货入库') {
									obj.image = 'icon-chukuguanli'
									obj.text = val.menu
								} else if (val.menu == '半成品入库') {
									obj.image = 'icon-chukuguanli'
									obj.text = val.menu
								} else if (val.menu == '半成品出库') {
									obj.image = 'icon-pandianguanli_1'
									obj.text = val.menu
								} else if (val.menu == '销售配货') {
									obj.image = 'icon-stores'
									obj.text = val.menu
								} else if (val.menu == '聚水潭调拨') {
									obj.image = 'icon-stores'
									obj.text = val.menu
								}

								if (JSON.stringify(obj) != "{}") {
									this.menu.push(obj)
								}

							})
						}
					}
				})
			},
			onClick(e) {
				console.log(e.data, 'ee')
				if (e.data == '库存盘点') {
					uni.navigateTo({
						url: '../kcpd/kcpd'
					})
				} else if (e.data == '扫描入库') {
					uni.navigateTo({
						url: '../smrk/smrk'
					})
				} else if (e.data == '半成品入库') {
					uni.navigateTo({
						url: '../bcprk/bcprk'
					})
				} else if (e.data == '扫描出库') {
					uni.navigateTo({
						url: '../smck/smck'
					})
				} else if (e.data == '半成品出库') {
					uni.navigateTo({
						url: '../bcpck/bcpck'
					})
				} else if (e.data == '并箱') {
					uni.navigateTo({
						url: '../bx/bx'
					})
				} else if (e.data == '退货入库') {
					uni.navigateTo({
						url: '../thrk/thrk'
					})
				} else if (e.data == '销售配货') {
					uni.navigateTo({
						url: '../xsph/xsph'
					})
				} else if (e.data == '聚水潭调拨') {
					uni.navigateTo({
						url: '../skudb/skudb'
					})
				}
			}
		},
	}
</script>

<style>
	.uni-grid-item-text {
		margin-top: 10upx !important;
		font-size: 35upx !important;
	}

	.iconfont {
		font-size: 80upx !important;
		color: #F7BA81 !important;
	}
</style>